package com.chalmers.foa.gamemodel.events.impl;

import java.util.List;

import android.util.Log;

import com.chalmers.foa.gamemodel.events.IEvent;
import com.chalmers.foa.gamemodel.gameobjects.IGameObject;

public class EventRespawn implements IEvent {

	List<IGameObject> objects;
	int boundID;

	public EventRespawn(List<IGameObject> _objects, int _boundID,
			boolean _startState) {
		objects = _objects;
		boundID = _boundID;
	}

	@Override
	public void switchActive() {
		for(IGameObject object:objects){
			synchronized (object) {
				if(!object.isAlive()){
					Log.v("Respawn 3","");
					object.revertToStartPosition();
				}
			}
		}
	}

	@Override
	public boolean isActive() {
		return true;
	}

	@Override
	public void reset() {
		for(IGameObject object:objects){
			object.revertToStartPosition();
		}
	}

	@Override
	public int getBoundID() {
		return boundID;
	}

}
